package pkev.xgrapher.component.models;

import pkev.xgrapher.common.entity.XFlowGraphics;
import pkev.xgrapher.Constants;

import java.awt.*;

public class Axis extends AbstractGrapherModel{
    @Override
    public void draw(XFlowGraphics g) {
        g.getG().setColor(new Color(0, 170, 26));

        g.drawLine(Constants.MIN_X, 0, Constants.MAX_X, 0);
        g.drawLine(0, Constants.MIN_Y, 0, Constants.MAX_Y);

        for (int i = 0; i < Constants.MAX_X; i += Constants.AXIS_DELTA) {
            g.drawLine(i, 1, i, -1);
        }

        for (int i = 0; i > Constants.MIN_X; i -= Constants.AXIS_DELTA) {
            g.drawLine(i, 1, i, -1);
        }

        for (int i = 0; i < Constants.MAX_Y; i += Constants.AXIS_DELTA) {
            g.drawLine(1, i, -1, i);
        }

        for (int i = 0; i > Constants.MIN_Y; i -= Constants.AXIS_DELTA) {
            g.drawLine(1, i, -1, i);
        }
    }

    @Override
    public int getLayoutIndex() {
        return -1;
    }
}
